package ru.vpitervip.app.client.ui;



import ru.vpitervip.app.client.place.MenuItemPlace;

import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.DivElement;
import com.google.gwt.text.shared.AbstractRenderer;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HasConstrainedValue;
import com.google.gwt.user.client.ui.NotificationMole;
import com.google.gwt.user.client.ui.SimplePanel;
import com.google.gwt.user.client.ui.ValuePicker;
import com.google.gwt.user.client.ui.Widget;

public class AppDesktopShell extends Composite {
	
	interface Binder extends UiBinder<Widget, AppDesktopShell> {
	}

	private static final Binder BINDER = GWT.create(Binder.class);

	
	@UiField DivElement error;
	@UiField SimplePanel master;
	@UiField NotificationMole mole;
	@UiField SearchPanelImpl searchPanel;
	@UiField(provided = true)
	ValuePicker<MenuItemPlace> placesBox = new ValuePicker<MenuItemPlace>(new AbstractRenderer<MenuItemPlace>() {
		@Override
		public String render(MenuItemPlace object) {
			return object.getName();
		}
	});

	public AppDesktopShell() {
		initWidget(BINDER.createAndBindUi(this));
	}


	/**
	 * @return the panel to hold the master list
	 */
	public SimplePanel getMasterPanel() {
		return master;
	}

	/**
	 * @return the notification mole for loading feedback
	 */
	public NotificationMole getMole() {
		return mole;
	}
	
	public SearchPanel getSearchPanel(){
	
		return searchPanel;
	}
	

	/**
	 * @return the navigator
	 */
	public HasConstrainedValue<MenuItemPlace> getPlacesBox() {
		return placesBox;
	}

	/**
	 * @param string
	 */
	public void setError(String string) {
		error.setInnerText(string);
	}
}

